package org.tuestudent.grouppa;

import android.app.Activity;
import android.app.ActionBar;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.os.Build;

public class Tasks extends Fragment {

    /**
     * opens the task info popup
     * 
     * @param taskID
     *            the id of the task of which the info should be in the popup
     */
    private void viewTaskPopup(int taskID) {
        // TODO:create code to open the view task popup
        // TODO:create code to retrieve the task credentials of task with taskID
    }

    /**
     * opens a popup to edit the taskInfo
     * 
     * @param taskID
     *            the id of the to edited task
     * @param info
     *            the current info of the task
     */
    private void editTaskPopup(int taskID, String info) {
        // TODO:create code to open a popup with an editable text area with the
        // current task info
    }

    /**
     * method that updates the task info
     * 
     * @param taskID
     *            the id of the to be updated task
     * @param newInfo
     *            the new info
     */
    private void editTask(int taskID, String newInfo) {
        // TODO:create code to update the task info
        taskInfoUpdatedPopup();
    }

    /**
     * opens a popup to confirm that the task info has successfully been updated
     */
    private void taskInfoUpdatedPopup() {
        // TODO:create popup to confirm that the task info has successfully been
        // updated
        // TODO:create 'ok' confirmation button
    }

    /**
     * method that removes task with id taskID
     * 
     * @param taskID
     *            the id of the to be removed task
     */
    private void removeTask(int taskID) {
        // TODO:create code to remove task taskID
    }

    /**
     * method that changes the completion of a task
     * 
     * @param taskID
     *            the id of the task
     * @param percent
     *            the percentage of completion
     */
    private void changeComplation(int taskID, int percent) {
        // TODO:create code to update the completion of the task
    }

    /**
     * opens the addTaskPopup
     */
    private void addTaskPopup() {
        // TODO:create code to open the popup
    }

    /**
     * the function that add a task to the planning
     * 
     * @param taskName
     *            the name of the task
     * @param taskDescription
     *            the description of the task
     * @param duedate
     *            the date for when it has to be done
     * @param responUsers
     *            a list of the responsible users
     */
    private void addTask(String taskName, String taskDescription, String duedate// ,
            // List<String>
            // responUSers
            // not sure if we will use list, and with we I mean you Sylwester :P
            ) {
        // TODO:create code to check for empty fields
        // TODO:create code to add the task
    }

    /**
     * closes the popup
     */
    private void close() {
        // TODO:create code to close the popup
    }

    /**
     * opens the time recording popup
     */
    private void timeRecordingPopup() {
        // TODO:create code to open the time recording popup
    }

    /**
     * records time
     * 
     * @param taskID
     *            the id of which the time should be added
     */
    private void recordTime(int taskID) {
        // TODO:create code to record time
    }

    /**
     * stops the recording of the time.
     */
    private void stopRecording() {
        // TODO:create code to stop recoding
        // sendTime(taskID, time)
    }

    /**
     * opens the add time popup
     */
    private void addTimePopup() {
        // TODO:open the add time popup
    }

    /**
     * adds the time to task taskID
     * 
     * @param taskID
     *            the id of the task
     * @param time
     *            the recorded time
     */
    private void sendTime(int taskID, String time) {
        // TODO:create code to add the time to taskID
    }

    /**
     * method that send the time sheet of the user to the users email
     * 
     * @param toEmail
     *            the email of the user
     */
    private void exportTimeSheet(String toEmail) {
        // TODO:create code to export the time sheet of toEmail to toEmail
    }

    /**
     * method that sends all the time sheets to the users email
     * 
     * @param toEmail
     *            the email of the user
     */
    private void exportAllTimeSheets(String toEmail) {
        // TODO:create code to export all time sheets to toEmail
    }

    // ----------------onCreateView for the GroupInfo
    // Fragment-------------------
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {

        // Inflate the view to its container
        View groupInfo =
                inflater.inflate(R.layout.fragment_tasks, container, false);
        return groupInfo;
    }

    @Override
    public void onStart() {
        super.onStart();
        Main.getContext().currentGrouppaFragment = this;
        AppContext ctx = Main.getContext();
        ctx.currentGrouppaFragment = this;
        ctx.setCurrentViewController(PlanningViewController.getInstance());
    };

}
